package com.orange.cetback.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.orange.cetback.pojo.entity.QuestionOptions;
import com.orange.cetback.mapper.QuestionOptionsMapper;
import com.orange.cetback.service.QuestionOptionsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author chenenjun
 * @since 2025-02-16
 */
@Service
public class QuestionOptionsServiceImpl extends ServiceImpl<QuestionOptionsMapper, QuestionOptions> implements QuestionOptionsService {

    @Override
    public List<QuestionOptions> OptionsByQuestionId(Integer questionId) {
        LambdaQueryWrapper<QuestionOptions> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(QuestionOptions::getQuestionId, questionId);
        List<QuestionOptions> questionOptions = this.baseMapper.selectList(wrapper);
        return questionOptions;
    }

    public List<QuestionOptions> OptionsByMaterialId(Integer materialId) {
        LambdaQueryWrapper<QuestionOptions> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(QuestionOptions::getMaterialId, materialId);
        List<QuestionOptions> questionOptions = this.baseMapper.selectList(wrapper);
        return questionOptions;
    }
}
